package com.example.demo;

import com.example.demo.config.TestProperties;
import com.example.demo.event.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @Autowired
    private UserService userService;
    @Autowired
    private TestProperties testProperties;

    @GetMapping("/register")
    public String register(String userName){
        log.info("发布注册事件开始");
        userService.register(userName);
        log.info("发布注册事件结束");
        return "OK";
    }

    @GetMapping("/config")
    public void config(){
        System.out.println(testProperties.getList());
    }
}
